package com.muyu.cloud.system.service.impl;

import com.muyu.cloud.system.domain.UserInfo;
import com.muyu.cloud.system.mapper.UserInfoMapper;
import com.muyu.cloud.system.service.UserInfoService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.regex.Pattern;

/**
 * @Author: DongZeLiang
 * @date: 2024/5/24
 * @Description: 用户业务实现层
 * @Version: 1.0
 */
@Service
@AllArgsConstructor
public class UserInfoServiceImpl implements UserInfoService {

    private final UserInfoMapper userInfoMapper;
    /**
     * 通过用户名称查询用户信息
     *
     * @param userName 用户名称
     *
     * @return 用户信息
     */
    @Override
    public UserInfo selectByuserName (String userName) {
        return userInfoMapper.selectByuserName(userName);
    }

    /**
     * 用户修改
     * @param userInfo
     * @return
     */
    @Override
    public Integer upd(UserInfo userInfo) {
        Pattern compile = Pattern.compile("/^(?:[\u4e00-\u9fa5·]{2,16})$/");
        if (!userInfo.getPetName().equals(compile)){

        }
        return userInfoMapper.upd(userInfo);
    }

    /**
     * 用户信息
     * @param userInfo
     * @return
     */
    @Override
    public List<UserInfo> userList(UserInfo userInfo) {
        return userInfoMapper.userList(userInfo);
    }
}
